struct Node
{
	int starting;
	int no_of_edges;
};

__kernel void Kernel(__global struct Node* g_graph_nodes, __global int* g_graph_edges, 
 __global int* g_graph_mask, __global int* g_updating_graph_mask, 
 __global int* g_graph_visited, __global int* g_cost, __const int no_of_nodes) 
{
	int tid = get_global_id(0);
	//g_cost[tid] = tid;
	if(tid < no_of_nodes && (1 == g_graph_mask[tid])) {
		g_graph_mask[tid] = 0;
		for(int i = g_graph_nodes[tid].starting; i < (g_graph_nodes[tid].no_of_edges + g_graph_nodes[tid].starting); i++) {
			int id = g_graph_edges[i];
			if(0 == g_graph_visited[id]) {
				g_cost[id] = g_cost[tid] + 1;
				g_updating_graph_mask[id] = 1;
			}
		}
	}
}